<template>
  <d2-container class="page">
    <div style="margin: 20px;"></div>
    <el-form label-width="80px" :model="formLabelAlign">
      <el-form-item label="用户昵称">
        <el-input v-model="formLabelAlign.nickname"></el-input>
      </el-form-item>
      <el-form-item label="登录名">
        <el-input v-model="formLabelAlign.loginId"></el-input>
      </el-form-item>
      <el-form-item label="旧密码">
        <el-input v-model="formLabelAlign.oldLoginPwd"></el-input>
      </el-form-item>
      <el-form-item label="新密码">
        <el-input v-model="formLabelAlign.newLoginPwd"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="handleUpdateInfo" type="primary">修改</el-button>
      </el-form-item>
    </el-form>
  </d2-container>
</template>

<script>
import api from "@/api";

export default {
  data() {
    return {
      formLabelAlign: {
        nickname: '',
        loginId: '',
        oldLoginPwd: '',
        newLoginPwd: ""
      }
    };
  },
  mounted() {
    for (const key in this.formLabelAlign) {
      this.formLabelAlign[key] = this.$store.state.d2admin.user.info[key]
    }
  },
  methods: {
    async handleUpdateInfo() {
      await api.SYS_SET_USER_INFO(this.$store.state.d2admin.user.info._id, this.formLabelAlign)
      this.$message("修改成功")
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
